package cn.javass.dp.strategy.mydemo4;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * <p><em>Created on 2021/2/1 14:31</em></p>
 *
 * @author x
 * @since 1.0.1
 */
public class MessageServiceStrategyFactory2 {

    private static Map<String,MessageService> services = new ConcurrentHashMap<String,MessageService>();

    public  static MessageService getMessageType(String type){
        return services.get(type);
    }

    static {
        services.put(MessageServiceEnum.NORMAL_MESSAGE.getValue(), new MessageServiceImpl1());
        services.put(MessageServiceEnum.GROUP_MESSAGE.getValue(), new MessageServiceImpl2());
        services.put(MessageServiceEnum.SYSTEM_MESSAGE.getValue(), new MessageServiceImpl3());
    }

}
